/* eslint-disable */
//获取权限列表
export function getrole() {
    var role = JSON.parse(sessionStorage.getItem("data")).roleList;
    if (role) {
        const roleArr = [];
        for (var i = 0; i < role.length; i++) {
            name = role[i].name;
            roleArr.push(name);
        }
        return roleArr;
    }
}

//获取一级菜单列表
export function getresourceList() {
    if (sessionStorage.getItem("data")) {
        var dataObj = JSON.parse(sessionStorage.getItem("data"));
        var resourceArr = dataObj.resourceList;
    }
    if (resourceArr) {
        const newArr = [];
        for (var i = 0; i < resourceArr.length; i++) {
            if (newArr.indexOf(resourceArr[i].moduleName) != -1) {
                continue;
            } else {
                newArr.push(resourceArr[i].moduleName);
            }
        }
        return newArr;
    }
}
//获取二级菜单title列表
export function gettitleList() {
    var dataObj = JSON.parse(sessionStorage.getItem("data"));
    if (sessionStorage.getItem("data")) {
        var dataObj = JSON.parse(sessionStorage.getItem("data"));
        var resourceArr = dataObj.resourceList;
    }
    if (resourceArr) {
        const newArr = [];
        for (var i = 0; i < resourceArr.length; i++) {
            if (newArr.indexOf(resourceArr[i].title) != -1) {
                continue;
            } else {
                newArr.push(resourceArr[i].title);
            }
        }
        return newArr;
    }
}

//获取角色资料
export function getAdminData() {
    var roleData = JSON.parse(sessionStorage.getItem("data"));
    return roleData;
}
